<template>
  
  <el-header style="  font-size: 12px;height: 100px;">
    <el-header style="text-align: right; font-size: 12px;height: 100px;">
    <h1 style="font-size: 30px; text-align: left;">发退药记录管理</h1>
    </el-header>
         <div class="toolbar">
      
    
    <div class="sub-title"></div>

           <!-- <span>门诊挂号</span> -->
         </div>
       </el-header>
      
      
          <el-row>
  <el-col :span="6"><div class="grid-content ep-bg-purple" />   
  <el-form-item label="编号/名称：" prop="orderNo" class="label" >
     <el-input v-model="form.orderNo" placeholder="请输入" />
   </el-form-item>
  </el-col>
   
  <el-form-item label="选择日期："> 
      <div class="block" >
         <el-date-picker
            v-model="form.orderDate"
      type="date"
      unlink-panels
      range-separator="To"
      start-placeholder="Start date"
      end-placeholder="End date"
      :shortcuts="shortcuts"
      :size="size"
      style="width: 200px;"
    />
  </div>
     </el-form-item>
   <el-form-item>
      <el-button type="primary" style="margin-left: 30px" @click="search">查询</el-button>
      <el-button type="primary" @click="resetForm">最近</el-button>
   </el-form-item>
    
 
  <el-col>
      <el-form-item label="操作类型：" style="margin-left: 30px;">
        <el-button type="primary"  plain>发药</el-button>
        <el-button type="primary" plain >退药</el-button>
      </el-form-item>
     
  </el-col>
  <el-col :span="6">
    
  </el-col>
</el-row>

  <el-tag style="margin : 20px;width: 200px; " type="primary">已选择{{  }}项<a style="margin-left: 30px;" href="">清空</a></el-tag>
  <el-main>
      <el-scrollbar>
        <el-table :data="tableData">
          <el-table-column type="selection"  />
          <el-table-column width="120px" value="pName" label="药单号" />
          <el-table-column width="120px" value="pName" label="姓名" />
          <el-table-column width="120px" value="pName" label="药品名称" />
          <el-table-column width="120px"  value="dName" label="日期" />
          <el-table-column width="120px"  value="cSatus" label="主诊医师" />
          <el-table-column width="120px"  value="cSatus" label="数量" />
          <el-table-column value="cSatus" label="费用" />
          <el-table-column  label="操作" >
              <el-button type="primary" @click="deleteOrder">详情</el-button>
              <el-button type="success" @click="lookOrder"> 编辑</el-button>
              <el-button type="danger" @click="deleteOrder">删除</el-button>
          </el-table-column>

        </el-table>
        <div class="demo-pagination-block" style="display: flex; justify-content: space-around; align-items: center;">
  <div class="demonstration">
    <el-button type="primary" @click="handleCounts">批量操作: {{ tableData.length }}条</el-button> 
  </div>
  <el-pagination
    v-model:current-page="currentPage4"
    v-model:page-size="pageSize4"
    :page-sizes="[10, 50, 100, 200]"
    :size="size"
    :disabled="disabled"
    :background="background"
    layout="sizes, prev, pager, next, jumper"
    hide-on-single-page:true
    prev-text="上一页"
    next-text="下一页"
    jump-text="'跳至'"
    :page-count="10"
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
   
  />
</div>
      </el-scrollbar>
    </el-main>


 </template>
 
 <script lang="ts" setup name="Order">
import axiosInstance from '@/utils/axiosUtils';
import { ref } from 'vue';
import { reactive, toRefs } from 'vue'
 import type { ComponentSize } from 'element-plus'
const currentPage4 = ref(1)
const pageSize4 = ref(10)
const size = ref<ComponentSize>('default')
const background = ref(true)
const disabled = ref(false)

const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`)
}
const handleCounts = () => {
  console.log('批量操作')
}
const shortcuts = [
{
  text: 'Last week',
  value: () => {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
    return [start, end]
  },
},
{
  text: 'Last month',
  value: () => {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
    return [start, end]
  },
},
{
  text: 'Last 3 months',
  value: () => {
    const end = new Date()
    const start = new Date()
    start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
    return [start, end]
  },
},
]
const tableData =reactive( [{
  
}
])
const form = reactive({
 orderNo:'',
 patientName:'',
 birthday:'',
 fangStatus:1,
 fangName:null,
 checkStatus:1,
 deptName:null,
 orderDate:null,
 pageNum:1,
 pageSize:10,
 total:0,

});
//清空表单函数
const resetForm=()=>{
for(const key in form){
  form[key]='';
}
};
const search=()=>{
};
const select=()=>{
};
const lookOrder=()=>{
  

};
const deleteOrder=()=>{
  
};
axiosInstance.get("/api/register/getOrderNo?id="+1).then(
response=>{
  console.log('success'+response.data);
  form.orderNo=response.data;
}
).catch(error=>{
console.log('error');
})


</script>






<style lang="css" link-ref="main.css"/>
<style scoped> 
h1{
  padding-left: 30px;
  
}
.label{
width: 200px;
 color: grey;
padding-left: 30px;

}
 
h3{
padding-left: 20px;
}
.demo-basic {
text-align: right;
}
.demo-basic .sub-title {
margin-bottom: 10px;
font-size: 14px;
color: var(--el-text-color-secondary);
}
.demo-basic .demo-basic--circle,
.demo-basic .demo-basic--square {
display: flex;
justify-content: flex-end;
align-items: right;
}
.demo-basic .block:not(:last-child) {
border-right: 1px solid var(--el-border-color);
}
.demo-basic .block {
flex: 1;
}
.demo-basic .el-col:not(:last-child) {
border-right: 1px solid var(--el-border-color);
}


</style>